<template>
  <div class="ta-c">
    <span style="height: 34px;width: 36px;" @tap="onPicker"><i class="if icon-pic" style="font-size: 21px;"></i></span>
    <div class="fs-xt">图片</div>
  </div>
</template>

<script>
export default {
  components: {
  },
  data () {
    return {
      tempFiles: []
    }
  },
  computed: {
  },
  watch: {
    tempFiles (nv) {
      let that = this
      nv.forEach(n => {
        let {path, size} = n
        that.$emit('success', {type: 'pic', path, size})
      })
    }
  },
  methods: {
    onPicker () {
      let that = this
      this.$emit('started', {type: 'pic'})
      wx.chooseImage({
        success (res, tempFiles) {
          that.tempFiles = res.tempFiles
        }
      })
    }
  }
}
</script>

<style scoped lang="less">
@import '../assets/less/var.less';
i {
  font-size: 23px;
}
span {
  position: relative;
  top: 9px;
}
</style>
